package com.softeem.springboot02.controller;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import com.softeem.springboot02.entity.User;
import com.softeem.springboot02.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {

    @Autowired
    private IUserService userService;

    @GetMapping("/user/{page}/{limit}")
    public PageInfo<User> list(
            @PathVariable Integer page,
            @PathVariable Integer limit){
        PageInfo<User> pages = userService.findByPage(page, limit);
        System.out.println(pages);
        return pages;
    }
}
